﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Com.FastSearch.Esp.Search.View;

namespace ESPWebPartsUnitTest.mock
{
    class ResultSpecificationMock :IResultSpecification
    {
       
        private ArrayList fullsortEnabledFields;      
        private ArrayList rankProfiles;      

        public ResultSpecificationMock()
        {
            InitResultSpecificationMock();
        }

        private void InitResultSpecificationMock()
        {
            fullsortEnabledFields = new ArrayList();
            fullsortEnabledFields.Add(new SimpleFieldMock("field1"));
            fullsortEnabledFields.Add(new SimpleFieldMock("field2"));            
            rankProfiles = new ArrayList();
            rankProfiles.Add(new RankProfileMock("default"));
            rankProfiles.Add(new RankProfileMock("rankprofile2"));
        }

        public bool IsNavigationEnabled()
        {
            return true;
        }

        public ArrayList GetNavigators()
        {
            throw new NotImplementedException();
        }

        public INavigator GetNavigator(string name)
        {
            throw new NotImplementedException();
        }

        public ArrayList GetNavigatorSets()
        {
            throw new NotImplementedException();
        }

        public INavigatorSet GetNavigatorSet(string name)
        {
            throw new NotImplementedException();
        }

        public INavigatorSet GetDefaultNavigatorSet()
        {
            throw new NotImplementedException();
        }

        public ArrayList GetResultViews()
        {
            throw new NotImplementedException();
        }

        public IResultView GetResultView(string name)
        {
            throw new NotImplementedException();
        }

        public IResultView GetDefaultResultView()
        {
            throw new NotImplementedException();
        }

        public ArrayList GetSortableFields()
        {
            throw new NotImplementedException();
        }

        public ArrayList GetFullsortEnabledFields()
        {
            return fullsortEnabledFields;
        }

        public ArrayList GetSummaryFields()
        {
            throw new NotImplementedException();
        }

        public ArrayList GetRankProfiles()
        {
            return rankProfiles;
        }

        public IRankProfile GetDefaultRankProfile()
        {
            throw new NotImplementedException();
        }

        public bool HasRankProfile(string name)
        {
            throw new NotImplementedException();
        }

        public bool IsClusteringEnabled()
        {
            throw new NotImplementedException();
        }

        public IClusteringSpecification GetClusteringSpecification()
        {
            throw new NotImplementedException();
        }

        public bool IsCategorizationEnabled()
        {
            throw new NotImplementedException();
        }

        public ICategorizationSpecification GetCategorizationSpecification()
        {
            throw new NotImplementedException();
        }

        public ArrayList Navigators
        {
            get;
            set;
        }

        public ArrayList NavigatorSets
        {
            get;
            set;
        }

        public INavigatorSet DefaultNavigatorSet
        {
            get;
            set;
        }

        public ArrayList ResultViews
        {
            get;
            set;
        }

        public IResultView DefaultResultView
        {
            get;
            set;
        }

        public ArrayList SortableFields
        {
            get;
            set;
        }

        public ArrayList FullsortEnabledFields
        {
            get { return fullsortEnabledFields; }            
        }

        public ArrayList SummaryFields
        {
            get;
            set;
        }

        public ArrayList RankProfiles
        {
            get { return rankProfiles; }            
        }

        public IRankProfile DefaultRankProfile
        {
            get;
            set;
        }

        public IClusteringSpecification ClusteringSpecification
        {
            get;
            set;
        }

        public ICategorizationSpecification CategorizationSpecification
        {
            get;
            set;
        }
    }


    class SimpleFieldMock:ISimpleField
    {      
        private readonly string name;
        private readonly FieldType type;
        private ITokenizationSpecification tokenizationSpecification;
        private string  defaultVectorization;
        private string alternativeVectorization;

        
        public SimpleFieldMock(string name)
        {
            this.name = name;
            type = FieldType.STRING;            
        }

        public bool IsBoundaryMatchEnabled()
        {
            return true;            
        }

        public bool IsSortable()
        {
            return true;
        }

        public bool IsFullsortEnabled()
        {
            throw new NotImplementedException();
        }

        public bool IsDynamic()
        {
            throw new NotImplementedException();
        }

        public bool IsTokenizationEnabled()
        {
            throw new NotImplementedException();
        }

        public ITokenizationSpecification GetTokenizationSpecification()
        {
            throw new NotImplementedException();
        }

        public bool IsVectorizationEnabled()
        {
            throw new NotImplementedException();
        }

        public string GetDefaultVectorization()
        {
            throw new NotImplementedException();
        }

        public string GetAlternativeVectorization()
        {
            throw new NotImplementedException();
        }

        public ITokenizationSpecification TokenizationSpecification
        {
            get { return tokenizationSpecification; }
             set { tokenizationSpecification = value; }
        }

        public string DefaultVectorization
        {
            get { return defaultVectorization; }
            set { defaultVectorization = value; }
        }

        public string AlternativeVectorization
        {
            get { return alternativeVectorization; }
            set { alternativeVectorization = value; }
        }

        public string GetName()
        {
            return name;
        }

        public new FieldType GetType()
        {
            return type;            
        }

        public bool IsSimple()
        {
            throw new NotImplementedException();
        }

        public bool IsScope()
        {
            throw new NotImplementedException();
        }

        public bool IsComposite()
        {
            throw new NotImplementedException();
        }

        public bool IsFieldGroup()
        {
            throw new NotImplementedException();
        }

        public bool IsSearchable()
        {
            throw new NotImplementedException();
        }

        public bool IsSummaryField()
        {
            throw new NotImplementedException();
        }

        public bool IsLemmatizationEnabled()
        {
            throw new NotImplementedException();
        }

        public bool IsSubstringEnabled()
        {
            throw new NotImplementedException();
        }

        public string GetSubstring()
        {
            throw new NotImplementedException();
        }

        public string Name
        {
            get { return name; }            
        }

        public FieldType Type
        {
            get { return type; }
        }

        public string Substring
        {
            get;
            set;
        }
        
    }
    class RankProfileMock : IRankProfile
    {
        private string name;       

        public RankProfileMock(string name)
        {
            this.name = name;
        }

        public string GetName()
        {
            return name;
        }

        public int GetAuthorityWeight()
        {
            throw new NotImplementedException();
        }

        public IField GetAuthorityField()
        {
            throw new NotImplementedException();
        }

        public int GetFreshnessWeight()
        {
            throw new NotImplementedException();
        }

        public IField GetFreshnessField()
        {
            throw new NotImplementedException();
        }

        public int GetProximityWeight()
        {
            throw new NotImplementedException();
        }

        public int GetContextWeight()
        {
            throw new NotImplementedException();
        }

        public ArrayList GetContextFields()
        {
            throw new NotImplementedException();
        }

        public int GetFieldWeight(string fieldname)
        {
            throw new NotImplementedException();
        }

        public int GetFieldWeight(IField f)
        {
            throw new NotImplementedException();
        }

        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        public int AuthorityWeight
        {
            get;
            set;
        }

        public IField AuthorityField
        {
            get;
            set;
        }

        public int FreshnessWeight
        {
            get;
            set;
        }

        public IField FreshnessField
        {
            get;
            set;
        }

        public IEnumerator CompositeRanks
        {
            get;
            set;
        }

        public IEnumerator ScopeRanks
        {
            get;
            set;
        }
    }
}
